//Application Window Component Constructor
function ApplicationWindow(e) {
	//load component dependencies
	var MapView = require('ui/common/map');

	//var HudView = require('ui/common/hudview')
	var HudView = require('ui/common/hudimage');
	//var StatusBar = require('ui/common/statusbar');
	var StatusBarView = require('ui/common/statusbarview');
	var CompassView = require('ui/common/compass');
		

	//construct UI
	
	//create window instance
	var self = Ti.UI.createWindow({
		backgroundColor:'#000000',
		navBarHidden: true,
		exitOnClose: true
	});
		
	//create mapview instance - bind to lower right of screen
	var mapView = new MapView();
	mapView.setHeight(e.height*0.85);
	mapView.setWidth(e.width*0.5);
	mapView.setRight('0px');
	mapView.setBottom('0px');
	self.add(mapView);
	
	//create hud webview instance - bind to upper left of screen below statusbar
	var hudView = new HudView({height: e.height, width: e.width, containerheight: e.height*0.5, containerwidth: e.width*0.5});
	hudView.setHeight(e.height*0.5);
	hudView.setWidth(e.width*0.5);
	hudView.setLeft('0px');
	hudView.setTop(e.height*0.1);
	self.add(hudView);
	
	/*
	var statusBar = new StatusBar({height: e.height, width: e.width, containerheight: e.height*0.1, containerwidth: e.width});
	statusBar.setHeight(e.height*0.1);
	statusBar.setWidth(e.width);
	statusBar.setLeft('0px');
	statusBar.setTop('0px');
	self.add(statusBar);
	*/

	
	//create statusbar view instance - bind to top of screen 
	var statusBarView = new StatusBarView(e);
	statusBarView.setHeight(e.height*0.1);
	statusBarView.setWidth(e.width);
	statusBarView.setLeft('0px');
	statusBarView.setTop('0px');
	self.add(statusBarView);	
	
	
	//create compass instance - bind to lower left
	var compassView = new CompassView({height: e.width, width: e.width, containerheight: e.width*0.15, containerwidth: e.width*0.15});
	compassView.setHeight(e.width*0.15);
	compassView.setWidth(e.width*0.15);
	compassView.setCenter({x: e.width*0.25, y: e.height*0.25 });
	self.add(compassView);
	
	return self;
	
}

//make constructor function the public component interface
module.exports = ApplicationWindow;
